﻿using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Text;
using DTO;

namespace DAO
{
    public class LoaiKhachHangDAO:DataProvider
    {
        public List<LoaiKhachHangDTO> LayDanhSachLoaiKhachHang()
        {
            List<LoaiKhachHangDTO> dsp = new List<LoaiKhachHangDTO>();
            SqlConnection connection = MoKetNoi();
            string sql = "SELECT * FROM LoaiKH";
            SqlCommand command = new SqlCommand(sql, connection);
            SqlDataReader reader = command.ExecuteReader();
            while (reader.Read())
            {
                LoaiKhachHangDTO p = new LoaiKhachHangDTO();
                p.MaLoaiKH = reader.GetInt32(0);
                p.TenLoaiKH = reader.GetString(1);
                dsp.Add(p);
            }
            return dsp;
        }
    }
}
